<?php
    $query="SELECT * FROM Zamowienie WHERE IdUmowy=0";

    $wynik=mysql_query($query) or die('zapytanie niudane: '.mysql_error());

    echo "<form action=\"skrypty/noweZamow/akcje/modUsZamow.php?login=$login\" method=\"post\">";
    echo "<table><tr>
				<td>Usuń</td>
                <td>Modyfikuj</td>
                <td>Kwota</td>
                <td>Data Przyjęcia</td>
                <td>Projektant</td>
                <td>Klient</td>
                <td>Opis</td>
			</tr>";

    while($line = mysql_fetch_array($wynik, MYSQL_NUM)){
            $adres = "skrypty/noweZamow/form/podglZamow.php?id={$line[0]}";
			echo "<tr>";
                echo "<td><input type=checkbox name=\"{$line[0]}\"></td>\n";
                echo "<td><Input type=radio name=\"mod\" value=\"{$line[0]}\"></td>\n";
                echo "<td>{$line[2]}</td>\n";
                echo "<td>{$line[3]}</td>\n";

                if($line[4]!=0){
                    $query = "SELECT * FROM Projektant WHERE id={$line[4]}";
                    $tmp=mysql_query($query) or die('zapytanie niudane: '.mysql_error());
                    $tmp = mysql_fetch_row($tmp);
                    echo "<td>{$tmp[1]} {$tmp[2]}</td>\n";
                }else{
                    echo "<td>brak</td>\n";
                }

                $query = "SELECT * FROM Klient WHERE idKlienta={$line[5]}";
                $tmp=mysql_query($query) or die('zapytanie niudane: '.mysql_error());
                $tmp = mysql_fetch_row($tmp);
                if($tmp[10])
                    echo "<td>{$tmp[10]}</td>";
                else
                    echo "<td>{$tmp[1]} {$tmp[2]}</td>";

                echo "<td><a target=\"_blank\" href=\"$adres\"
                        onclick=\"window.open('$adres', '_blank', 'resizable=no,width=800,height=600').focus(); return false\">treść</a></td>\n";


            echo "</tr>\n";
		}
        echo "</table>";
        echo "<input type=submit name=\"usun\" id=\"usun\" value=\"usuń\"> | ";
        echo "<input type=submit name=\"modyfikuj\" id=\"modyfikuj\" value=\"modyfikuj\">";
        echo "</form>";



?>
